package service.impl;

import mapper.AccessControlDeviceMapper;
import org.apache.ibatis.session.SqlSession;
import pojo.AccessControlDevice;
import service.AccessControlDeviceService;
import utils.MyBatisUtil;

import java.util.List;


public class AccessControlDeviceServiceImpl implements AccessControlDeviceService {


    @Override
    public List<AccessControlDevice> page(Integer pageIndex, Integer pageSize, Integer name) {
        int offIndex = (pageIndex-1)*pageSize;
        return MyBatisUtil.createSqlSession().getMapper(AccessControlDeviceMapper.class).page(offIndex,pageSize,name);
    }

    @Override
    public Integer count() {
        return MyBatisUtil.createSqlSession().getMapper(AccessControlDeviceMapper.class).count();
    }

    @Override
    public Integer add(AccessControlDevice accessControlDevice) {
        return  MyBatisUtil.createSqlSession().getMapper(AccessControlDeviceMapper.class).add(accessControlDevice);
    }

    @Override
    public Integer update(Integer status,Integer id) {
        return  MyBatisUtil.createSqlSession().getMapper(AccessControlDeviceMapper.class).update(status,id);
    }
}
